import { Component, OnInit } from '@angular/core';
import { MemberService } from "../service/member.service";

interface Member {
  id: string;
  login: string;
  avatar_url: string;
}

@Component({
  selector: 'members',
  templateUrl: './members.component.html',
  styleUrls: ['./members.component.css']
})
export class MembersComponent implements OnInit {

  // Angular  http模块

  members: Member[];

  constructor(private memberService: MemberService) { }

  ngOnInit() {
    this.memberService.getMembers()
      .subscribe(data => {
        if (data) this.members = data;
      });
  }
}
